package name.marz.to.go.ahg.sonybank.executer;

import java.net.URI;
import java.util.ArrayList;
import java.util.List;

import name.marz.to.go.ahg.core.AutoGetterHttpClient;
import name.marz.to.go.ahg.core.checker.DocumentChecker;
import name.marz.to.go.ahg.core.executer.AbstractLoginExecuter;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class SonyBankLoginExecuter extends AbstractLoginExecuter {
	DocumentChecker checker = new SonyBankLoginChecker();

	public SonyBankLoginExecuter(URI uri, AutoGetterHttpClient client,
			String[] userIds, String pass) {
		super(uri, client, userIds, pass);
	}

	@Override
	protected List<NameValuePair> getRequestParameters() {
		String tenNo = getUserIdentifiers()[0];
		String kozaNo = getUserIdentifiers()[1];
		String cid = getUserIdentifiers()[2];
		String tid = getUserIdentifiers()[3];
		String zid = getUserIdentifiers()[4];
		String password = getUserPass();
		List<NameValuePair> params = new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair("LoginKS", ""));
		params.add(new BasicNameValuePair("__type", "0003"));
		params.add(new BasicNameValuePair("__fid", "NBP000109"));
		params.add(new BasicNameValuePair("__gid", "NBP000109G01"));
		params.add(new BasicNameValuePair("__sid", ""));
		params.add(new BasicNameValuePair("B_ID", "1"));
		params.add(new BasicNameValuePair("__uid", kozaNo));

		params.add(new BasicNameValuePair("CookieId", cid));
		params.add(new BasicNameValuePair("TanmatsuShubt", tid));
		params.add(new BasicNameValuePair("ZenkaiLogonTime", zid));

		params.add(new BasicNameValuePair("TenNo", tenNo));
		params.add(new BasicNameValuePair("KozaNo", kozaNo));
		params.add(new BasicNameValuePair("Password", password));
		return params;
	}

	@Override
	protected DocumentChecker getChecker() {
		return checker;
	}
}
